<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <canvas id="container" width="1300" height="1300"></canvas>
  <script>
    var ctx;
    function draw() {
      var canvas = document.getElementById('container');
      if (!canvas.getContext) return;
      var ctx = canvas.getContext("2d");

      ctx.save()
      ctx.translate(100, 100)
      ctx.strokeRect(0, 0, 100, 100)
      ctx.restore()
      ctx.save()

      ctx.translate(220, 220);
      ctx.fillRect(0, 0, 100, 100)

      ctx.restore()
      ctx.translate(330, 330);
      ctx.fillRect(0, 0, 100, 100)
    }
    draw();
  </script>
</body>
</html>